<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
    //window.location.href = 'http://192.168.5.104:9527/login';

    //list后台返回中的对象
    var object = {
        "id" : 1,
        "name" : "hujingyu",
        "sex" : 1,
        "secText" : "男"
    }

    //修改后的对象
    var object_update = {
        "id" : 1,
        "name" : "hujingyu",
        "sex" : 2
    }

    var object_result = f(object,object_update);

    if (Object.keys(object_result).length > 0){
        //向后端发出申请修改数据库
    }

    function f(object,object_update) {
        var object_result = {};
        var count = false;
        for(var key in object_update){
            if (object_update[key] != object[key]){
                object_result[key]= object_update[key];
                count = true;
            }
        }
        if (count){
            object_result["id"]= object_update["id"];
        }
        return object_result;
    }
</script>
</body>
</html>